-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix center aligned image style in Classic theme #39594
Conversation
Size Change: +4 B (0%) Total Size: 1.21 MB
ℹ️ View Unchanged
|
Hi There! Thanks for the PR, let me try to clarify what this is trying to solve. This is trying to solve the fact that the default layout styles are not printed in the frontend for the "root" level of the classic themes using layout (Astra theme). Is that right? This is not an issue that is specific to the "image block" or "center alignment" though. As you can see on the "layout support" dev note. These themes are still required to define the layout for their "root" level. In the case of astra I guess it's If you take a look at the styles in the frontend, Astra already adds the Let me know If I'm missing something. |
Thanks for checking out my PR! I checked the dev note. I thought alignment should be fully supported in classic themes as well as block themes. If so, this PR is no longer needed and can be closed. |
On the root level yes, for nested levels (inside group blocks...), styles and alignments will be automatic. The reason is simple, each classic theme uses different containers for the root level, so we can't generate the right styles automatically. We don't know what selector to use. Thanks for the PR 👍 |
Fix #39592
Related #38657 / #39422
What?
This PR fixes center aligned image style in the Classic theme with layout support.
Why?
In #38657, the div wrapper of image block has been removed on the front end side for themes that support layout.
I found a problem that the image block is not center aligned on frontend in the classic theme with layout support.
In the Classic theme with layout support, the wrapper div is removed as in the Block theme, and HTML with the structure "
figure.wp-block-image.aligncenter
" is generated.However, left/right auto margin style for this selector is not generated.
How?
I have added a
.wp-block-image.aligncenter
selector in addition to the.wp-block-image .aligncenter
selector that is the fallback for the classic theme.This change does not affect block themes, and classic themes with no layout support.
Testing Instructions
Use the following content for testing:
I also tested the following four themes.
1. Simple Classic Theme ( without theme.json )
style.css
:index.php
:2. Simple Classic Theme ( with theme.json )
Add
theme.json
to "1. Simple Classic Theme":3. Astra ( Classic Theme with theme.json )
I looked at the questioner's site in the support forum (mentioned in #39592), and found that astra theme was used.
This theme is a classic theme with layout support.
4. Twenty Twenty Two (Block Theme)